package com.hgw.Demo06_MementoPattern.Exercises21_7_6;

/**
 * Data time:2021/12/18 22:10
 * StudentID:2019112118
 * Author:hgw
 * Description: 游戏场景类，原发器
 */
public class GameScene {
    private String scene;
    private int lifeValue;

    public String getScene() {
        return scene;
    }

    public void setScene(String scene) {
        this.scene = scene;
    }

    public int getLifeValue() {
        return lifeValue;
    }

    public void setLifeValue(int lifeValue) {
        this.lifeValue = lifeValue;
    }

    public void restore(SceneMemento m) {
        this.scene = m.getScene();
        this.lifeValue = m.getLifeValue();
    }

    public SceneMemento save() {
        return new SceneMemento(this.scene, this.lifeValue);
    }

    public void display() {
        System.out.println("当前游戏场景为：" + this.scene + ",");
        System.out.println("您还有：" + this.lifeValue + " 条命！");
    }
}
